function [A_f,B_f,Z_f,end_iters,obj]= addview(X_t,A_t,B_t,Z_last,T ,iters, lambda)
%addview 增加视图最优化的过程
maxIter = 500;
flag = 1;
iter = 0;
i = 1;
At = A_t;
Bt = B_t;
Zt = Z_last;
while flag
    if (iter==0)
        iter=iter+1;  
        obvalue = trace((At*X_t - Zt*T*Bt)'*(At*X_t - Zt*T*Bt)) + lambda*trace((Zt - Z_last)'*(Zt - Z_last));
        obj(i) = obvalue;
    end
        iter = iter+1;
        i = i+1;
        At = update_A(X_t,T, Bt, Zt);                                                              
        Bt = update_B(X_t,T, At, Zt );
        Zt = update_Z(X_t, T, At, Bt, Z_last, lambda);
        obvalue = trace((At*X_t - Zt*T*Bt)'*(At*X_t - Zt*T*Bt)) + lambda*trace((Zt - Z_last)'*(Zt - Z_last));
        obj(i) = obvalue;
  
    %tmpp
    %if (iter>2) && (abs((obj(iter)-obj(iter-1))/(obj(iter)))<1e-6 || iter>maxIter)
    if (iter>2) && (abs((obj(iter-1)-obj(iter))/(obj(iter)))<1e-6 || iter>maxIter)
        flag =0;
        end_iters = iter+iters;
    end
end
A_f = At;
B_f = Bt;
Z_f = Zt;

end